package com.itheima.Classs;

import com.itheima.domain.Student;

import java.util.ArrayList;

public class Test02 {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Student stu1 = new Student("陈羽凡", 23);//添加
        Student stu2 = new Student("贾乃亮", 24);
        Student stu3 = new Student("王宝强", 25);
        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        for (int i = 0; i < list.size(); i++) {
            //System.out.println(list.get(i).getName() + "..." + list.get(i).getAge());
      Student stu = list.get(i);//将对象集合的元素对象暂时表示
            System.out.println(stu.getName()+"..."+stu.getAge());
        }

    }
}
